import request from '@/utils/request'

// 查询检验单位列表
export function getTree() {
  return request({
    url: "/qcmasterdata/category/list",
    method: "get"
  });
}

export function getTreeByDivisionNameAPI(divisionName) {
  return request({
    url: "/qcmasterdata/category/selectListByDivisionName?divisionName=" + divisionName,
    method: "get"
  });
}

// 查询检验单位列表-老版本
export function getTreeOld(divisionName) {
  return request({
    url: "/qcmasterdata/category/selectListByDivisionName?divisionName=" + divisionName,
    method: "get"
  });
}

// 新增分类节点信息
export function addTreeNode(data) {
  return request({
    url: '/qcmasterdata/category',
    method: 'post',
    data: data
  })
}


// 修改分类节点信息
export function updTreeNode(data) {
  return request({
    url: '/qcmasterdata/category',
    method: 'put',
    data: data
  })
}

//删除分类节点信息
export function delTreeNode(id) {
  return request({
    url: '/qcmasterdata/category/'+id,
    method: 'delete'
  })
}


//查询指定分类节点下的所有物料信息
export function getListById(id) {
  return request({
    url: '/qcmasterdata/category/material/'+id,
    method: 'get'
  })
}

//按条件查询指定分类节点绑定的物料信息
export function getList(query) {
  return request({
    url: '/qcmasterdata/category/material/list',
    method: 'get',
    params: query
  })
}

// 一键绑定操作
export function bind(data) {
  return request({
    url: '/qcmasterdata/category/material/bind',
    method: 'post',
    data: data
  })
}

//查询来料履历列表
export function getIncomingMaterialHistoryList(query) {
  return request({
    url: '/ny-iqc/resume/list',
    method: 'get',
    params: query
  })
}
// 导出来料履历列表
export function exportExcel(data) {
  return request({
    url: '/ny-iqc/resume/export',
    method: 'post',
    data: data
  })
}
// 编辑绑定信息
export function editBind(data) {
  return request({
    url: '/qcmasterdata/category/material',
    method: 'post',
    data: data
  })
}
// 生成履历表
export function generate(query) {
  return request({
    url: '/ny-iqc/resume/generate',
    method: 'get',
    params: query
  })
}
export function filedownloadgenerationrecordList(params) {
  return request({
    url: "/ny-iqc/generator/filedownloadgenerationrecord/list",
    method: "get",
    params,
  });
}

export function filedownloadgenerationrecordDelete(id) {
  return request({
    url: '/ny-iqc/generator/filedownloadgenerationrecord/delete/' + id,
    method: 'get'
  })
}

export function materialBatchUnbind(data) {
  return request({
    url: 'qcmasterdata/category/material/batchUnbind',
    method: 'post',
    data
  })
}
